
#include "gcc_output_processor.hpp"
#include "environment.hpp"
#include "executor.hpp"

#include <cstdio>
#include <ncurses.h>
#include <string>

using namespace Forte;

struct Listener : public CompilerOutputListener
{
  void OnError(std::string const& error, std::string const& filename, unsigned linenum)
  {
    printf("--> %s:%u: %serror\033[0m: %s\n", filename.c_str(), linenum, "\033[31m", error.c_str());
  }

  void OnWarning(std::string const& error, std::string const& filename, unsigned linenum)
  {
    printf("--> %s:%u: warn: %s\n", filename.c_str(), linenum, error.c_str());
  }
};

static bool volatile is_building = false;

int main(int argc, char const** argv)
{
  /*
  // Arguments
  if (argc < 2)
  {
    fprintf(stderr, "ARGUMENTS: <build command>\n");
    return -1;
  }
  std::string const build_command(argv[1]);

  // Execute
  Listener listener;
  GccOutputProcessor processor(listener);
  Executor executor(processor);
  executor.Execute(build_command.c_str());*/

  // init
  //attron(COLOR_PAIR(1));
  mvprintw(0,0,"Hello, World!");
  move(1,0);
  //attroff(COLOR_PAIR(1));
  mvchgat(0,0,-1,A_BLINK,1,NULL);
  refresh();
  getch();
  endwin();

  return 0;
}

